/*
** ############################################################################
**     Project   : osdee - Operative Systems Design for Embedded Envrionments
**     File      : SchM_Tasks.c
**     Revision  ; 1.0
**     Abstract  :
**         Scheduled Tasks implementation.
**
**     Copyright : 2014 Fernando Rodriguez - Victor Huidobro, 
**                 Open source with out any responsability.
**     
**     mail      : frr@gmail.com, vhuidobrog@gmail.com
** ############################################################################
*/

#include "SchM_Tasks.h"
#include <MC9S12XEP100.h>

/*
** ===================================================================
**     Function    :  SchM_Task__X
**
**     Description :
**         SCHM Task callbacks implementations.
**         User can define his/her own callback implementation
**         for any channel, using this prototypes or maybe 
**         any other function linked to the task in the configuration.
** ===================================================================
*/

#define SCHM_TASK_LOOP_COUNT    0x500 /* Defines the work load for all threads */

void vTask_Work(UINT8 u8PortMask)
{
  UINT16 u8count = 0;
  
  PORTB |= u8PortMask;  
  while(u8count++ < SCHM_TASK_LOOP_COUNT);
  PORTB &= ~u8PortMask;
}


void SchM_Task_1(void)
{
  vTask_Work(PORTB_PB1_MASK);
}

void SchM_Task_2(void)
{
  vTask_Work(PORTB_PB2_MASK);
}

void SchM_Task_3(void)
{
  vTask_Work(PORTB_PB3_MASK);
}

void SchM_Task_4(void)
{
  vTask_Work(PORTB_PB4_MASK);
}

void SchM_Task_5(void)
{
  vTask_Work(PORTB_PB5_MASK);
}

void SchM_Task_6(void)
{
  vTask_Work(PORTB_PB6_MASK);
}

void SchM_Task_7(void)
{
  vTask_Work(PORTB_PB7_MASK);
}
